class MyTask extends Thread { public void run() { for(int i=1;i<=200;i++) System.out.print(i+"- "); } } class YourTask implements Runnable { public void run() { for(int i=1;i<=200;i++) System.out.print(i+"= "); } } class demo { public static void main(String args[]) { MyTask tsk1=new MyTask(); YourTask tsk2=new YourTask(); Thread trd=new Thread(tsk2); tsk1.start(); trd.start(); } }